//
// Created by DengLibin on 2019/1/1 0001.
//

//
// Created by DengLibin on 2019/1/1 0001.
//

//
// Created by DengLibin on 2019/1/1 0001.
//

//
// Created by DengLibin on 2018/12/31 0031.
//

//
// Created by DengLibin on 2018/12/29 0029.
//

#include <wx/app.h>
#include <wx/wx.h>
#include <wx/wxprec.h>
#include <string>
#include <wx/dcbuffer.h>
using namespace std;
/**
 * 对话框
 */
class Demo8Frame : public wxFrame
{
private:
    //声明事件表
wxDECLARE_EVENT_TABLE();


public:
    Demo8Frame(string & title):wxFrame(nullptr, wxID_ANY, title)
    {
        initPosition();
    }

    void initDialog(){
       wxMessageDialog * messageDialog = new wxMessageDialog(this, wxT("我很好"),
               wxT("你好啊"),wxYES_NO);
       int flag = messageDialog->ShowModal();
       switch (flag){
           case wxID_YES:
               wxLogMessage(wxString("yes"));
               break;
           case wxID_NO:
               wxLogMessage(wxString("no"));
               break;
           default:
               break;

       }
    }

    void initPosition(){
        //设置窗口位置
        wxPoint position;
        position.x = 300;
        position.y = 300;
        SetPosition(position);
        //设置背景色
        wxColour backGroundColor(0,100,0);
        SetBackgroundColour(backGroundColor);
        //设置宽高
        this->m_minWidth = 800;
        this->m_minHeight = 600;
    }

};


class Demo8App:public wxApp
{
    bool OnInit()
    {
        string title = "Demo8";
        //  wxFrame * frame = new wxFrame(NULL, wxID_ANY, "第一个窗体");
        Demo8Frame * frame = new Demo8Frame(title);
        frame->Show();
        frame->initDialog();
        return true;
    }
};
//事件和函数绑定
wxBEGIN_EVENT_TABLE(Demo8Frame, wxFrame)
wxEND_EVENT_TABLE()

// 有了这一行就可以使用 OurApp& wxGetApp了()
DECLARE_APP(Demo8App)
//告诉主应用程序是哪个类wxWidgets（启动）
//IMPLEMENT_APP(Demo8App)
